<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

    <body>

        <ui:composition template="./../../WEB-INF/templates/noFooterCompanyTemplate.xhtml">

            <ui:define name="content">
                <h:form id="editCompanyForm" enctype="multipart/form-data">
                    <p:growl id="companyGrowl" showDetail="false" sticky="true" life="4000" />
                    <p:panel styleClass="noMargin noPadding noBorder inlineBlock">
                        <div class="viewCandidateColumnTitle personalBackgroundButton marginBottom20">
                            <span>#{messages.SearchGeneralInformation}</span>
                        </div>
                        <h:panelGrid styleClass="createCandidatePanelGrid" columns="1"> 
                            <p:inputText  id="companyName" value="#{editCompanyBean.company.name}" required="true" requiredMessage="#{messages.CompanyNameRequired}" label="#{messages.CompanyName}">  
                                <p:ajax event="change" update=":editCompanyForm:companyGrowl" />
                            </p:inputText>
                            <p:watermark for="companyName" value="#{messages.CompanyName}" /> 
                            <p:inputText id="companyBusinessName" value="#{editCompanyBean.company.businessName}" required="false" requiredMessage="#{messages.CompanyNameRequired}" label="#{messages.CompanyName}">  
                                <p:ajax event="change" update=":editCompanyForm:companyGrowl" />
                            </p:inputText>
                            <p:watermark for="companyBusinessName" value="#{messages.CompanyBusinessName}" />
                            <p:inputText id="companyPhone" value="#{editCompanyBean.company.phone}" required="false" requiredMessage="#{messages.CompanyNameRequired}" label="#{messages.CompanyName}">  
                                <p:ajax event="change" update=":editCompanyForm:companyGrowl" />
                            </p:inputText>
                            <p:watermark for="companyPhone" value="#{messages.Phone}" />
                            <p:inputText id="companyCIF" value="#{editCompanyBean.company.cif}" required="false" requiredMessage="#{messages.CompanyNameRequired}" label="#{messages.CompanyName}">  
                                <p:ajax event="change" update=":editCompanyForm:companyGrowl" />
                            </p:inputText>
                            <p:watermark for="companyCIF" value="#{messages.CompanyCif}" />
                            <p:inputText id="companyContact" value="#{editCompanyBean.company.contact}" required="false" requiredMessage="#{messages.CompanyNameRequired}" label="#{messages.CompanyName}">  
                                <p:ajax event="change" update=":editCompanyForm:companyGrowl" />
                            </p:inputText>
                            <p:watermark for="companyContact" value="#{messages.CompanyContact}" />

                            <p:selectOneMenu required="false" converter="#{countryConverter}" id="selectCountry"  value="#{editCompanyBean.company.country}" effect="fade"  label="#{messages.Country}" requiredMessage="#{messages.CountryRequired}">  
                                <f:selectItem itemLabel="#{messages.Country}" itemValue="" />  
                                <f:selectItem itemLabel="#{countryBundle[resourcesBean.spain.idCountry.toString()]}"  itemValue="#{resourcesBean.spain}" />  
                                <f:selectItems value="#{userResourcesBean.countries}" var="country" itemLabel="#{countryBundle[country.idCountry.toString()]}" itemValue="#{country}"/>  
                                <p:ajax event="change" process="@this" update="selectProvince selectTown" />
                            </p:selectOneMenu>

                            <p:selectOneMenu required="false" converter="#{provinceConverter}" id="selectProvince"  value="#{editCompanyBean.company.province}" effect="fade"  label="#{messages.Province}" requiredMessage="#{messages.ProvinceRequired}">  
                                <f:selectItem itemLabel="#{messages.Province}" itemValue="" />  
                                <f:selectItems value="#{editCompanyBean.company.country.provinceList}" var="province" itemLabel="#{province.description}" itemValue="#{province}"/>  
                                <p:ajax event="change" process="@this" update="selectTown" />
                            </p:selectOneMenu>

                            <p:selectOneMenu required="false" converter="#{townConverter}" id="selectTown"  value="#{editCompanyBean.company.town}" effect="fade"  label="#{messages.Town}" requiredMessage="#{messages.TownRequired}">  
                                <f:selectItem itemLabel="#{messages.Town}" itemValue="" />  
                                <f:selectItems value="#{editCompanyBean.company.province.townList}" var="town" itemLabel="#{town.description}" itemValue="#{town}"/>  
                                <p:ajax event="change" process="@this" update=":editCompanyForm:companyGrowl" />
                            </p:selectOneMenu>
                            <p:inputText id="companyAddress" value="#{editCompanyBean.company.address}" required="false" requiredMessage="#{messages.CompanyNameRequired}" label="#{messages.CompanyName}">  
                                <p:ajax event="change" update=":editCompanyForm:companyGrowl" />
                            </p:inputText>
                            <p:watermark for="companyAddress" value="#{messages.Address}" />
                            <p:inputText id="companyPostalCode" value="#{editCompanyBean.company.postalCode}" required="false" requiredMessage="#{messages.CompanyNameRequired}" label="#{messages.CompanyName}">  
                                <p:ajax event="change" update=":editCompanyForm:companyGrowl" />
                            </p:inputText>
                            <p:watermark for="companyPostalCode" value="#{messages.PostalCode}" />
                            <p:inputTextarea autoResize="false" styleClass="ui-inputtext summaryTextArea" counterTemplate="{0} #{messages.CharactersRemaining}" id="companySummary" value="#{editCompanyBean.company.summary}" maxlength="1024" counter="counter"></p:inputTextarea>
                            <p:watermark value="#{messages.CompanySummary}" for="companySummary"></p:watermark>            
                            <h:outputText styleClass="bodyText" id="counter" />
                        </h:panelGrid>
                    </p:panel>
                    <p:panel id="imagesPanel" styleClass="noMargin noPadding noBorder editCompanyPicturePanel">
                        <div class="viewCandidateColumnTitle educationalBackgroundButton marginBottom20">
                            <span>#{messages.EditLogo}</span>
                        </div>
                        <p:commandLink onclick="$('input[type=file][class=logoFileUpload]').click()" rendered="#{editCompanyBean.company.logo==null}">
                            <h:graphicImage rendered="#{editCompanyBean.company.logo==null}" styleClass="allWidth marginBottom20" library="images" name="silueta1.png"></h:graphicImage>
                        </p:commandLink>
                        <p:commandLink onclick="$('input[type=file][class=logoFileUpload]').click()" rendered="#{editCompanyBean.company.logo!=null}">
                            <h:graphicImage rendered="#{editCompanyBean.company.logo!=null}" styleClass="allWidth marginBottom20" value="/companyFiles/#{editCompanyBean.company.idCompany.toString()}/images/#{editCompanyBean.company.logo}"></h:graphicImage>
                        </p:commandLink>
                        <p:fileUpload auto="true" styleClass="logoFileUpload floatright right" id="imageFileUploader" uploadLabel="#{messages.Upload}" label="#{messages.BustImageFileUploadLabel}" cancelLabel="#{messages.Cancel}" invalidSizeMessage="#{messages.BustFileSize}" invalidFileMessage="#{messages.BustFileFormat}" requiredMessage="#{messages.BustRequired}" fileUploadListener="#{editCompanyBean.uploadLogo}" update="imagesPanel" process="@parent" sizeLimit="3000000" allowTypes="/(\.|\/)(gif|jpe?g|png)$/"/>
                    </p:panel>
                    <p:panel styleClass="noMargin noPadding noBorder center">
                        <p:commandButton styleClass="updateButton imageBackgroundButton" value="#{messages.Update}" update=":editCompanyForm:companyGrowl"  action="#{editCompanyBean.editCompany}" />                        
                    </p:panel>
                </h:form>
            </ui:define>

        </ui:composition>

    </body>
</html>
